<?php

/**
 * This is the model class for table "kib_a".
 *
 * The followings are the available columns in table 'kib_a':
 * @property string $kode_ka
 * @property string $kode_png
 * @property string $kode_aset
 * @property string $no_reg
 * @property double $luas
 * @property string $thn_png
 * @property string $lok_tanah
 * @property string $sts_hak
 * @property string $tgl_sertif
 * @property string $no_sertif
 * @property string $penggunaan
 * @property string $asal
 * @property double $harga_prh
 * @property double $harga_pasar
 * @property string $dasar_hrg
 * @property string $kondisi
 * @property string $ket_aset
 * @property string $kode_milik
 */
class KibA extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'kib_a';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('luas, harga_prh, harga_pasar', 'numerical'),
			array('kode_png, thn_png', 'length', 'max'=>4),
			array('kode_aset', 'length', 'max'=>14),
			array('no_reg, kondisi', 'length', 'max'=>25),
			array('lok_tanah, penggunaan', 'length', 'max'=>75),
			array('sts_hak', 'length', 'max'=>1),
			array('no_sertif', 'length', 'max'=>20),
			array('asal', 'length', 'max'=>45),
			array('dasar_hrg', 'length', 'max'=>15),
			array('kode_milik', 'length', 'max'=>2),
			array('tgl_sertif, ket_aset', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('kode_ka, kode_png, kode_aset, no_reg, luas, thn_png, lok_tanah, sts_hak, tgl_sertif, no_sertif, penggunaan, asal, harga_prh, harga_pasar, dasar_hrg, kondisi, ket_aset, kode_milik', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'kode_ka' => 'Kode Ka',
			'kode_png' => 'Kode Png',
			'kode_aset' => 'Kode Aset',
			'no_reg' => 'No Reg',
			'luas' => 'Luas',
			'thn_png' => 'Thn Png',
			'lok_tanah' => 'Lok Tanah',
			'sts_hak' => 'Sts Hak',
			'tgl_sertif' => 'Tgl Sertif',
			'no_sertif' => 'No Sertif',
			'penggunaan' => 'Penggunaan',
			'asal' => 'Asal',
			'harga_prh' => 'Harga Prh',
			'harga_pasar' => 'Harga Pasar',
			'dasar_hrg' => 'Dasar Hrg',
			'kondisi' => 'Kondisi',
			'ket_aset' => 'Ket Aset',
			'kode_milik' => 'Kode Milik',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('kode_ka',$this->kode_ka,true);
		$criteria->compare('kode_png',$this->kode_png,true);
		$criteria->compare('kode_aset',$this->kode_aset,true);
		$criteria->compare('no_reg',$this->no_reg,true);
		$criteria->compare('luas',$this->luas);
		$criteria->compare('thn_png',$this->thn_png,true);
		$criteria->compare('lok_tanah',$this->lok_tanah,true);
		$criteria->compare('sts_hak',$this->sts_hak,true);
		$criteria->compare('tgl_sertif',$this->tgl_sertif,true);
		$criteria->compare('no_sertif',$this->no_sertif,true);
		$criteria->compare('penggunaan',$this->penggunaan,true);
		$criteria->compare('asal',$this->asal,true);
		$criteria->compare('harga_prh',$this->harga_prh);
		$criteria->compare('harga_pasar',$this->harga_pasar);
		$criteria->compare('dasar_hrg',$this->dasar_hrg,true);
		$criteria->compare('kondisi',$this->kondisi,true);
		$criteria->compare('ket_aset',$this->ket_aset,true);
		$criteria->compare('kode_milik',$this->kode_milik,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return KibA the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
